#!/usr/bin/env bash

# maxwell.sh

# Copyright (C) 2010 Scott C. MacCallum
# scottmaccal@gmail.com

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

#       |                                  80 Columns                                    |

faridayix_build=$HOME/faridayix-build

#******************
# Introduce Maxwell
#******************
clear
printf "Hello $USER, my name is Maxwell."
printf "\n\n"
sleep 4

clear
printf "I will help you build the Faridayix operating system."
printf "\n\n"
sleep 4

#***************************************
# Make Build and File System Directories
#***************************************
clear
printf "I will start by making the build and file system directories."
printf "\n\n"
mkdir --verbose $HOME/faridayix-build
printf "\n"

printf "binary"
printf "\n\n"
mkdir --verbose $faridayix_build/bin
printf "\n"
sleep 4

printf "boot"
printf "\n\n"
mkdir --verbose $faridayix_build/boot
printf "\n"
sleep 4

printf "defaults"
printf "\n\n"
mkdir --verbose $faridayix_build/defaults
printf "\n"
sleep 4

printf "devices"
printf "\n\n"
mkdir --verbose $faridayix_build/dev
printf "\n"
sleep 4 

printf "etcetera"
printf "\n\n"
mkdir --verbose $faridayix_build/etc
printf "\n"
sleep 4

printf "etcetera defaults"
printf "\n\n"
mkdir --verbose $faridayix_build/etc/defaults
printf "\n"
sleep 4

printf "ecetera mail"
printf "\n\n"
mkdir --verbose $faridayix_build/etc/mail
printf "\n"
sleep 4

printf "ecetera name database"
printf "\n\n"
mkdir --verbose $faridayix_build/etc/namedb
printf "\n"
sleep 4

printf "periodic"
printf "\n\n"
mkdir --verbose $faridayix_build/etc/periodic
printf "\n"
sleep 4

printf "ecetera point-to-point protocol"
printf "\n\n"
mkdir --verbose $faridayix_build/etc/ppp
printf "\n"
sleep 4

printf "mount"
printf "\n\n"
mkdir --verbose $faridayix_build/mnt
printf "\n"
sleep 4

printf "processes"
printf "\n\n"
mkdir --verbose $faridayix_build/proc
printf "\n"
sleep 4

printf "rescue"
printf "\n\n"
mkdir --verbose $faridayix_build/rescue
printf "\n"
sleep 4

printf "root"
printf "\n\n"
mkdir --verbose $faridayix_build/root
printf "\n"
sleep 4

printf "source"
printf "\n\n"
mkdir --verbose $faridayix_build/src
printf "\n"
sleep 4

printf "system binary"
printf "\n\n"
mkdir --verbose $faridayix_build/sbin
printf "\n"
sleep 4

printf "temporary"
printf "\n\n"
mkdir --verbose $faridayix_build/tmp
printf "\n"
sleep 4

#****************************************************************************
# Get the Latest Stable Release of the Core GNUs Not UNIX Compiler Collection
#****************************************************************************
printf "I will now download a compressed archive of the latest stable release of the core GNUs Not UNIX Compiler Collection."
printf "\n\n"
curl --verbose --location --remote-name ftp://ftp.gnu.org/gnu/gcc/gcc-4.4.2/gcc-core-4.4.2.tar.bz2
printf "\n\n"

#**************************************************************
# Get the Latest Stable Release of the Linux Kernel Version 2.4
#**************************************************************

#**************************************************************
# Get the Latest Stable Release of the Linux Kernel Version 2.6
#***************************************************************
curl --verbose --location --remote-name http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.6.32.3.tar.bz2

#********************************************************
# Get the Latest Stable Release of the Bourne Again Shell
#********************************************************
curl --verbose --location --remote-name ftp://ftp.gnu.org/gnu/bash/bash-4.1.tar.gz

# GNU Editing Macros

curl --verbose --location --remote-name ftp://ftp.gnu.org/gnu/emacs/emacs-23.1.tar.gz

curl --verbose --location --remote-name http://www.python.org/ftp/python/3.11/Python-3.1.1.tar.bz2

curl --verbose --location --remote-name http://www.mercurial.selenic.com/release/mercurial-1.4.2.tar.gz

printf "I will now uncompress and extract the archive of the latest stable release of the core GNUs Not UNIX Compiler Collection to the build directory."
printf "\n\n"
tar --verbose --bzip2 --extract --file gcc-core-4.4.2.tar.bz2
printf "\n\n"

tar --verbose --bzip2 --extract --file linux-2.6.32.3.tar.bz2

tar --verbose --gunzip --extract --file bash-4.1.tar.gz

tar --verbose --gunzip --extract --file emacs-23.1.tar.gz

tar --verbose --bzip2 --extract --file Python-3.1.1.tar.bz2

tar --verbose --bzip2 --extract --file mercurial-1.4.2.tar.gz

